#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
数据库工具函数
"""


def row_to_dict(row):
    """将数据库行转换为字典"""
    if row is None:
        return None
    return dict(row)


def rows_to_dict_list(rows):
    """将数据库行列表转换为字典列表"""
    return [dict(row) for row in rows]